package svgedit.gui.commands;

import svgedit.svg.SVGPaint;
import svgedit.svg.SVGStylable;

/**
 * Handles undoing and redoing of stroke colour changes
 * @author SARJ
 *
 */
public class ChangeStrokeCommand implements Command
{

	SVGStylable element;
	SVGPaint oldPaint= new SVGPaint();
	SVGPaint newPaint;
	
	/**
	 * The constuctor for the styling command
	 * @param element The element to style
	 * @param newPaint the new paint color to apply
	 */
	public ChangeStrokeCommand(SVGStylable element, SVGPaint newPaint)
	{
		this.element = element;		
		this.oldPaint.setValueFromPaint(element.getStroke());		
		this.newPaint = newPaint;
	}

	@Override
	public void executeUndo()
	{			
		element.getStroke().setValueFromPaint(oldPaint);		
	}

	@Override
	public void executeRedo()
	{	

		element.getStroke().setValueFromPaint(newPaint);
		
	}
}